const { Compilation } = require("webpack");

class Plugin1 {
  apply(compiler) {
    compiler.hooks.emit.tap('Plugin1', (Compilation) => {
      console.log('emit.tap 111')
    })
    compiler.hooks.emit.tapAsync('Plugin1', (Compilation, cb) => {
      setTimeout(() => {
        console.log('emit.tapAsync 111')
        cb();
      }, 1000)
    })
    compiler.hooks.emit.tapPromise('Plugin1', (Compilation) => {
      return new Promise((resolve) => {
        setTimeout(() => {
          console.log('emit.tapPromise 111')
          resolve();
        }, 1000)
      })
    })
    compiler.hooks.afterEmit.tap('Plugin1', (Compilation) => {
      console.log('afterEmit.tap 111')
    })

    compiler.hooks.done.tap('Plugin1', (stats) => {
      console.log('done.tap 111')
    })
  }
}
module.exports = Plugin1;